home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 45
/
Amiga Format CD45 (1999-09)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-11].iso
/
-serious-
/
programming
/
c
/
vbcc-grexx
/
vc.ged
< prev
next >
Wrap
Text File
|
1999-08-09
|
4KB
|
154 lines
/*
** $VER: vc.ged (5 Feb 1998)
**
** **
** PROGRAMNAME: vc.ged
**
** FUNCTION: Compile current file using vbcc
*/
GOLDEDNAME = "GOLDED.VBCC" /* Adjust this if you want */
OPTIONS RESULTS /* enable return codes */
if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
address GOLDEDNAME
'LOCK CURRENT' /* lock GUI, gain access */
OPTIONS FAILAT 6 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
/* ------------------------- INSERT YOUR CODE HERE: ------------------ */
'QUERY CAT'
isGerman = (result = "deutsch")
'QUERY ANYTEXT'
if (result = 'TRUE') then
do
'QUERY DOC VAR OLDNAME' /* remember current file name */
'QUERY FILE VAR FILENAME' /* Let GoldED work for us */
'QUERY PATH VAR PATH'
'QUERY MODIFY VAR MODIFIED'
dotposfile = LASTPOS(".", FILENAME) /* gives some security */
if (dotposfile = 0) THEN DO
if( isGerman) THEN 'REQUEST STATUS "Dateiname muß eine Endung besitzen!"'
else 'REQUEST STATUS "Filename should have an extension"'
'UNLOCK'
EXIT 5
END
BASENAME = LEFT( FILENAME, dotposfile-1) /* name without extension */
FULLNAME = OLDNAME
if (MODIFIED = 'TRUE') THEN DO
if (isGerman) THEN
'REQUEST BODY "Datei noch nicht gespeichert!" BUTTON "_Speichern|_Abbruch"'
else 'REQUEST BODY "File not yet saved!" BUTTON "_Save|_Cancel"'
if (RESULT = 1) THEN DO
'SAVE ALL'
END
else DO
'UNLOCK'
EXIT
END
END
'UNLOCK'
ADDRESS COMMAND /* address shell */
PRAGMA('D', "PATH") /* set shell current directory */
call pragma 'Stack', 250000
'run <>NIL: VBrowse <>NIL: editor "GED Config GOLDED:Config/C.prefs Line %d %s" top 14 left 0 width 640 height 184'
'vc <NIL: >T:vcout.txt ' || FILENAME || ' -+ -lextra -lmieee -o ' || BASENAME
ok = (RC = 0)
warn = ( RC <= 5)
'VSend <T:vcout.txt >NIL:'
ADDRESS /* address host (GoldED) */
'LOCK QUIET NAME ' || FULLNAME
if (res = 1) then do /* Temporary compiled */
'NAME NEW ' || OLDNAME /* restore old file name */
if (MODIFIED = 1) then do /* No, we didn't really save the text :-) */
'TEXT T="A"' /* so we have to set the modify-flag */
'BACK'
end
end
if (ok | warn) then do /* Compiler run ok? */
if (isGerman) then
'REQUEST BODY="vc fertig. Programm starten ?" BUTTON="_starten|_NEIN"'
else
'REQUEST BODY="vc done. Run program ?" BUTTON="_run|_NO"'
if (result = 1) then do
'REQUEST TITLE="Commandline options" BODY="'PATH || '/' || BASENAME '" BUTTON="_OK|_Cancel" STRING VAR OPTIONS'
IF options ~= "OPTIONS" THEN DO
'UNLOCK'
ADDRESS /* Address shell */
BASENAME || ' <>"con:0/200//240/'|| BASENAME ||'/CLOSE/WAIT/SCREEN ' || GOLDEDNAME'"' || OPTIONS
/* Yeah, we now have output AND input !!! */
EXIT
END
end
end
end
else do
if (isGerman) then
'REQUEST BODY="Kein Text vorhanden ?!"'
else
'REQUEST BODY="Text buffer is empty ?!"'
end
/* ---------------------------- END OF YOUR CODE ----------------------- */
'UNLOCK' /* VERY important: unlock GUI */
EXIT
/* mygetenv stolen from some TeX scripts ... */
mygetenv: PROCEDURE /* WHEN will ARexx supply GetEnv/SetEnv ? */
PARSE ARG name
IF open(TEMPFILE,"ENV:"||name,'r') THEN DO
gives = readln(TEMPFILE)
CALL close TEMPFILE
END
ELSE gives = ""
RETURN gives
SYNTAX:
SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
EXIT